#include<iostream>
#include<cmath>
#include<ctime>

const int nnz =825737;
const int rows =119425;
const double reference = 0.0001;

struct nape{
    int Ai,Aj;
    double Avalue;
};

int main(){
    std::clock_t starttime,endtime;
    nape Mymatrix[nnz];
    double B[rows];
    for(int i=0;i<nnz;i++){
        std::cin>>Mymatrix[i].Aj>>Mymatrix[i].Ai>>Mymatrix[i].Avalue;
        Mymatrix[i].Ai--;
        Mymatrix[i].Aj--;
    }
    for(int i=0;i<rows;i++) std::cin>>B[i];

        double w=1.7;
        double residual=__DBL_MAX__;
        double x[rows]={1},y[rows];
        long flag=1;
        starttime=clock();
        while(residual>reference && flag<60000){
            residual=0;
            flag++;
            for(int i=0;i<nnz;i++){
                int first=Mymatrix[i].Ai;
                double key=1;
                y[first]=B[first];
                while(i!=nnz && Mymatrix[i].Ai==first){
                    if(first<Mymatrix[i].Aj){
                        y[first]+=(-Mymatrix[i].Avalue * x[Mymatrix[i].Aj]);
                    }
                    else if(first==Mymatrix[i].Aj) key=Mymatrix[i].Avalue;
                    else{
                        y[first]+=(-Mymatrix[i].Avalue * y[Mymatrix[i].Aj]);
                    }
                    i++;
                }
                y[first]/=key;
                i--;
            }
            for(int i=0;i<rows;i++){
                residual= ( residual>fabs(x[i]-y[i]) ? residual : fabs(x[i]-y[i]));
                x[i]=x[i]+w*(y[i]-x[i]);
            }
        }
        endtime=clock();
        std::cout<<"Time:"<<(double)(endtime-starttime)/CLOCKS_PER_SEC<<"  迭代次数："<<flag<<std::endl<<"result=[";
        for(int i=0;i<rows-1;i++) std::cout<<x[i]<<", ";
        std::cout<<x[rows-1]<<"]^T"<<std::endl;
    return 0;
};